﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Workflow2211A.Consol.Data;
using Workflow2211A.Consol.Steps;
using WorkflowCore.Interface;

namespace Workflow2211A.Consol.Workflows
{
    public class AddNumberWorkflow : IWorkflow<MyDataClass>
    {
        public string Id => nameof(AddNumberWorkflow);

        public int Version => 1;

        public void Build(IWorkflowBuilder<MyDataClass> builder)
        {
            //设计流程执行步骤
            builder.StartWith<StartStep>()
                   .Then<AddNumberStep>(x => 
                   {
                       //把Input1这个值赋值给Value1
                       x.Input(step=>step.Value1,data=>data.Input1);
                       x.Input(step=>step.Value2,data=>data.Input2);

                       //设置输出参数
                       x.Output(data=>data.OutputResult,step=>step.Output);
                   })
                   .Then<EndStep>();
        }
    }
}
